package com.test.call;

import com.test.person.Person;
import com.test.trans.Trans;
import com.test.util.OutInstance;

import java.util.List;

public class CallHandler {

    public void callPerson() {
        OutInstance instance = new OutInstance();
        String[] names = new String[] {"com.test.person.Child", "com.test.person.Man", "com.test.person.Woman"};
        Class<?>[] types = new Class[] {};
        List<Person> results = instance.list(Person.class, names, types);
        results.stream().forEach(result -> System.out.println(result.getClass().getName()));
    }

    public void callTrans() {
        OutInstance instance = new OutInstance();
        String[] names = new String[] {"com.test.trans.Bike", "com.test.trans.Car"};
        Class<?>[] types = new Class[] {OutInstance.class};
        List<Trans> results = instance.list(Trans.class, names, types, instance);
        results.stream().forEach(result -> System.out.println(result.getClass().getName()));
    }

    public static void main(String[] args) {
        CallHandler handler = new CallHandler();
        handler.callPerson();
        System.out.println("--------------");
        handler.callTrans();
    }
}
